package com.chisheng.controller;

import com.chisheng.pojo.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

/**
 * HelloController
 *
 * @author chisheng
 */
@Api(tags = "Swagger 测试 Controller")
@RestController
@RequestMapping("/api")
public class HelloController {

    @ApiOperation("返回一句话")
    @GetMapping(value = "/hello", produces = "application/json")
    public String hello(@ApiParam("姓名") @RequestParam(required = false, defaultValue = "stranger") String name) {
        return String.format("Hi, %s, welcome!", name);
    }

    @ApiOperation("返回一个用户实例")
    @GetMapping(value = "/user", produces = "application/json")
    public User getUser() {
        return new User("test", "test");
    }

}
